package com.et114.components.jcaptcha;

import com.octo.captcha.component.image.backgroundgenerator.GradientBackgroundGenerator;
//import com.octo.captcha.component.image.fontgenerator.TwistedAndShearedRandomFontGenerator;
import com.octo.captcha.component.image.textpaster.RandomTextPaster;
import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage;
import com.octo.captcha.component.word.wordgenerator.RandomWordGenerator;
import com.octo.captcha.engine.image.ListImageCaptchaEngine;
import com.octo.captcha.image.gimpy.GimpyFactory;
import com.octo.captcha.component.image.textpaster.TextPaster;
import com.octo.captcha.component.word.wordgenerator.WordGenerator ; 
import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator ; 
import com.octo.captcha.component.image.fontgenerator.FontGenerator;
import com.octo.captcha.component.image.wordtoimage.WordToImage ;
import com.octo.captcha.component.image.fontgenerator.RandomFontGenerator;


import java.awt.*;

/**
 * @author guanhw
 */
public class CaptchaEngine extends ListImageCaptchaEngine {
	protected void buildInitialFactories ( ) {
		WordGenerator wordGenerator = ( new RandomWordGenerator( "123456789ABCDEFGHLMNW" ) );
		TextPaster textPaster = new RandomTextPaster( new Integer( 4 ) , new Integer( 5 ) , Color.BLACK );
		BackgroundGenerator backgroundGenerator = new GradientBackgroundGenerator( new Integer( 150 ) , new Integer( 30 ) , Color.WHITE , Color.WHITE );
		Font [ ] fontsList = new Font [ ] { new Font ( "Arial" , Font.BOLD , 10 ) ,
				new Font ( "Tahoma" , Font.BOLD , 10 ) , new Font ( "Verdana" , Font.BOLD , 10 ) };
		FontGenerator fontGenerator = new RandomFontGenerator( new Integer( 16 ) , new Integer(  16 ) , fontsList );
		WordToImage wordToImage = new ComposedWordToImage( fontGenerator, backgroundGenerator, textPaster );
		addFactory( new GimpyFactory( wordGenerator, wordToImage ) );
	}
}
